#!/usr/bin/env bash
set -e
mkdir -p /opt/tmp/
mkdir -p /data/db/

wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-3.6.2.tgz
tar -zxvf mongodb-linux-x86_64-rhel70-3.6.2.tgz
mv mongodb-linux-x86_64-rhel70-3.6.2.tgz /opt/tmp
mv mongodb-linux-x86_64-rhel70-3.6.2 /opt/mongdb

echo -e "bind_ip = 0.0.0.0
dbpath=/data/db/
logpath=/data/db/mongo.log
logappend=true
fork=true
port=27017
auth=true
">>/opt/mongdb/bin/mongodb.cnf

# ./mongod -f ./mongodb.cnf
# ./mongo
# use spider
# db.createUser({user:"paladin",pwd:"123456",roles:[{role:"dbOwner",db:"spider"}]})
